<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        var ws;
        function abc()
        {
            if ("WebSocket" in window)
            {
                // 打开一个 web socket
                ws = new WebSocket("ws://localhost:43000/websocket/"+value);

                ws.onopen = function()
                {
                    fillData("连接成功")
                };

                ws.onmessage = function (evt)
                {
                    var received_msg = evt.data;
                    fillData(received_msg)
                };

                ws.onclose = function()
                {
                    // 关闭 websocket
                   fillData("连接关闭了")
                };
            }

            else
            {
                // 浏览器不支持 WebSocket
                alert("您的浏览器不支持 WebSocket!");
            }
        }



        function fillData(data) {
            document.getElementById("result").innerHTML = data;
            if (data == 1) {
                location.href = "http://www.baidu.com";
            }
        }

    </script>
</head>
<body onload="abc()">
订单号:  <br>
<img src="http://tomcat03.qfjava.cn:81/payment">
<br>
<span id="result"></span>
</body>
</html>


